package com.itaq.cheetah.serviceA.config.jackson.introspector;

import com.fasterxml.jackson.databind.introspect.Annotated;
import com.fasterxml.jackson.databind.introspect.NopAnnotationIntrospector;
import com.itaq.cheetah.serviceA.config.anno.Decrypt;
import com.itaq.cheetah.serviceA.config.jackson.deserialize.DecryptDeseserializer;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

/**
 * @author cheetah
 * @date 2021/10/27
 */
@Component
@Slf4j
public class DecryptAnnotationIntrospector extends NopAnnotationIntrospector {

    @Override
    public Object findDeserializer(Annotated am) {
        Decrypt annotation = am.getAnnotation(Decrypt.class);
        if (annotation != null) {
            return DecryptDeseserializer.class;
        }
        return super.findDeserializer(am);
    }
}
